package com.cc.moxingvoice.model;

import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;

import com.cc.moxingvoice.utils.FilesUtil;

/**
 * 创建日期：2018/3/4 on 22:11
 * 描述：
 * 作者：郭士超
 * QQ：1169380200
 */

public class AddVoiceItem implements Comparable<AddVoiceItem> {

    private String name;
    private String path;
    private Drawable pic;
    private boolean voice;

    public AddVoiceItem(String name, String path, Drawable pic, boolean voice) {
        this.name = name;
        this.path = path;
        this.pic = pic;
        this.voice = voice;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Drawable getPic() {
        return pic;
    }

    public void setPic(Drawable pic) {
        this.pic = pic;
    }

    public boolean isVoice() {
        return voice;
    }

    public void setVoice(boolean voice) {
        this.voice = voice;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @Override
    public int compareTo(@NonNull AddVoiceItem o) {  // Arrays.sort()会自动调用此方法比较
        Long long1 = FilesUtil.getFileTime(this.path);
        Long long2 = FilesUtil.getFileTime(o.path);
        return -long1.compareTo(long2);
    }

}
